﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Ic.Web
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        protected void Application_Start(object sender, EventArgs e)
        {
            //log4net.Config.XmlConfigurator.Configure();

            // 控制器与spring整合
            ControllerBuilder.Current.SetControllerFactory
                (typeof(Ic.Web.Controllers.SpringControllerFactory));
            // 注册Area
            Ic.Web.Controllers.Band.BandArea.RegisterAllAreas();
            Ic.Web.Controllers.News.NewsArea.RegisterAllAreas();
            // 注册mapping
            RegisterRoutes(RouteTable.Routes);            
        }

        static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{resource}.aspx/{*pathInfo}");     

            //RouteCollectionExtensions.MapRoute(
            //    routes,
            //    "Band.mvc",                                              // Route name
            //    "{controller}/{action}/{id}",                       // URL with parameters
            //    new { Controller = "Band", Action = "Index", Id = "" }
            //    , new { Controller = @"[^\.]*" }
            //);

        }
    }
}